<?php 
namespace app\admin\controller;

use cmf\controller\AdminBaseController;
use cmf\controller\BaseController;

use think\Db;

	class PayController extends BaseController
	{



		function make(){

			 vendor('alipay.AopSdk');
			
			//vendor('alipay.aop.AopClient');	
			$aop = new \AopClient ();  
			// echo 234;
			// exit;
			$aop->gatewayUrl = 'https://openapi.alipaydev.com/gateway.do';  
			$aop->appId = '2016090900469526';  
			$aop->rsaPrivateKey = 'MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCPHd30mdnY69v6I6w1dwNLR7XaVwi9GVrKYbHBnlVAblb2gcB/4Yjk3XdfhQqjx7hB8Cu0tHLLTOI/uJWzfpkke0NVnrR5TN0gY/NO6q/62styvKRlthUjXZ0XGMCi6BghXE6gxzAvxFnAh5/8827GkPvIx4tW8itHSqJ8fr5kxLOdtd+LAuyOcfVTlDj42sRHOGTWO7ni4k35g1OrmH1DEQHW/czQMR4fJXD9jyUl74TNjMnQHHDBjF6BYSYagYdytavgr7pc9uk02fX/EBDIZ7wJO7M4MFsFugFtmdmgLRMVZaNm1OrbPJPE8Uwhc/+zRgFUomIl0/bcGoaysQvhAgMBAAECggEAJ7hlWra8hHzpf6IY8HnIe0M60I9pSHpZ/WNh31ffV1OIZUAbuiJRSRvCPsuA6XXLyNkseCnA1nXPMVo8iiWvwTVIueGjOys/D/dNlvCByQCiiIScp/ICKd+YcsmW5V+/Grsww2SlFgzL0CiUGbNCYm/owY/IN2hc5JttP1o542Nd6YvqlHFp42hJsdnS6dcorBPF3LuHX6MXsjOGjmQNUyzAaVO0wFAidgJtpc0WAq4VDaUDJjpxjJEA/bXHva23VAo5aFAOjIi7HbMJKu/aTAubZx7JgOTwxjD2MIZoJkmLwYYYJYm7MMakAscOS6/B3NOdvftlIn9EFVePZXDthQKBgQDNIvWmKdkVii7Y3pN2q6JGHktjlYqovtzbqd2f+xDRSAjQKU/w559KwFCKuM66G6A3ctGSbGCNmT4fodXyaaaShVqrFxOFm6gNYF0KdvNLTdMwkBM1GD16Q6A2swqqxT6xhAA07xYPEA0g9cOHhHQEIc95o43gmvtKhZnuACPTSwKBgQCymjISDO2RiJ2fWO5lKWZz5XJY1LFnO1Jt1NEGxazf4km+ms28jOPs0KOdmVe/yShrEcS7zGzkAHP/3bBsJqp/k/JlQeXcDLcHUGIU+zZ/BguUg02cvb7AOvYxOd5JNPShK1vPKhIHO/6OjuZeCtmmd0cejBcts9NUsBO7/wN2AwKBgEVzTI+RI3nzaqDp2isXOL1cjFGO038F/2gvPmVnbu4r4S/4jKQXBwsbySjuIK9JoxiiuulD3/yQoUO8Wt7Tfh2lIGlESsu1Q1QkB9v/IaehFZsfbCFRr56xPpDGVRoz5WHcOuWw/FrlKEy8aBJ9eXncqI2aHfKpBeLZEKBPU9G5AoGAZLieqh1OULeJpJaDgttRIuTvkncIQN5sgvH0m2wZLP0xd2NXyRBvbVrQGo2itc6ck50mpH4Jnp8+y7nax3Maze3CUiZSmcE16tMDLS/qsMHY//z4ZP+AtmnJ80LeP8y0dLu9/9uK5TeJPB4MflaCHeXAXtLEM4rpECZoSqnq6r8CgYEAvpC0diexb4R9d1qJKwEWr4+Wwha70yoj99n9hS0laBBTodGFK84PjWgqc7NOGUJZ4J1yuwty/RYJ43wBQiUYdNYXwLdgz+qKojgra9erqPQMjpWEFMnYVqmbw21qxWjY9+2YcUHqVwvEpEJZTrlSvPIeYv1gd3vSTNgNEluET/w=';  
			$aop->apiVersion = '1.0';  
			$aop->signType = 'RSA2';  
			$aop->postCharset= 'utf-8';  
			$aop->format='json';  
		
			$request = new \AlipayTradePagePayRequest ();  
			$request->setReturnUrl('http://erp.crejoy.cn/admin/wxcommon/test');  
			$request->setNotifyUrl('http://erp.crejoy.cn/admin/wxcommon/test');  
			$request->setBizContent('{"product_code":"FAST_INSTANT_TRADE_PAY","out_trade_no":"2016032001010110231","subject":"Iphone6 16G","total_amount":"88.88","body":"Iphone6 16G"}');

//请求  
		
			$result = $aop->pageExecute ($request);

//输出  
			echo $result;

		}



		function select_status(){
						 vendor('alipay.AopSdk');
			$aop = new \AopClient ();
			$aop->gatewayUrl = 'https://openapi.alipaydev.com/gateway.do';
			$aop->appId = '2016090900469526';
			$aop->rsaPrivateKey = 'MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCPHd30mdnY69v6I6w1dwNLR7XaVwi9GVrKYbHBnlVAblb2gcB/4Yjk3XdfhQqjx7hB8Cu0tHLLTOI/uJWzfpkke0NVnrR5TN0gY/NO6q/62styvKRlthUjXZ0XGMCi6BghXE6gxzAvxFnAh5/8827GkPvIx4tW8itHSqJ8fr5kxLOdtd+LAuyOcfVTlDj42sRHOGTWO7ni4k35g1OrmH1DEQHW/czQMR4fJXD9jyUl74TNjMnQHHDBjF6BYSYagYdytavgr7pc9uk02fX/EBDIZ7wJO7M4MFsFugFtmdmgLRMVZaNm1OrbPJPE8Uwhc/+zRgFUomIl0/bcGoaysQvhAgMBAAECggEAJ7hlWra8hHzpf6IY8HnIe0M60I9pSHpZ/WNh31ffV1OIZUAbuiJRSRvCPsuA6XXLyNkseCnA1nXPMVo8iiWvwTVIueGjOys/D/dNlvCByQCiiIScp/ICKd+YcsmW5V+/Grsww2SlFgzL0CiUGbNCYm/owY/IN2hc5JttP1o542Nd6YvqlHFp42hJsdnS6dcorBPF3LuHX6MXsjOGjmQNUyzAaVO0wFAidgJtpc0WAq4VDaUDJjpxjJEA/bXHva23VAo5aFAOjIi7HbMJKu/aTAubZx7JgOTwxjD2MIZoJkmLwYYYJYm7MMakAscOS6/B3NOdvftlIn9EFVePZXDthQKBgQDNIvWmKdkVii7Y3pN2q6JGHktjlYqovtzbqd2f+xDRSAjQKU/w559KwFCKuM66G6A3ctGSbGCNmT4fodXyaaaShVqrFxOFm6gNYF0KdvNLTdMwkBM1GD16Q6A2swqqxT6xhAA07xYPEA0g9cOHhHQEIc95o43gmvtKhZnuACPTSwKBgQCymjISDO2RiJ2fWO5lKWZz5XJY1LFnO1Jt1NEGxazf4km+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apiVersion = '1.0';
			$aop->signType = 'RSA2';
			$aop->postCharset='utf-8';
			$aop->format='json';
			$request = new \AlipayTradeQueryRequest ();
			$request->setBizContent("{" .
				"\"out_trade_no\":\"2016032001010110231\"," .
				"\"trade_no\":\"2017110921001004180200329764\"" .
				"  }");
			$result = $aop->execute ( $request); 
			echo $result;
			exit;
			$responseNode = str_replace(".", "_", $request->getApiMethodName()) . "_response";
			$resultCode = $result->$responseNode->code;
			if(!empty($resultCode)&&$resultCode == 10000){
				echo "成功";
			} else {
				echo "失败";
			}

		}















	}
